home *** CD-ROM | disk | FTP | other *** search
/ Turnbull China Bikeride / Turnbull China Bikeride - Disc 1.iso / HENSA / MATHS / PLPLOT / PLPLOT.ZIP / doc / plshade.do < prev    next >
Encoding:
Text File  |  1993-10-25  |  3.5 KB  |  111 lines

  1.  
  2. void plshade(PLFLT *a, PLINT nx, PLINT ny, char *defined, PLFLT left, 
  3.     PLFLT right, PLFLT bottom, PLFLT top, void (*mapform)(), 
  4.     PLFLT shade_min, PLFLT shade_max, 
  5.     PLINT sh_color, PLINT sh_width, PLINT min_color, PLINT min_width,
  6.     PLINT max_color, PLINT max_width, void (*fill)(), PLINT rectangular)
  7.  
  8. arguments:
  9.     PLFLT &(a[0][0])    Contains array to be plotted. The array
  10.                 must have been declared as PLFLT a[nx][ny].
  11.                 See following note on fortran-style arrays.
  12.     PLINT nx, ny        dimension of array 'a'
  13.     char &(defined[0][0])   Contains array of flags, 1 = data is
  14.                 valid, 0 = data is not valid. This
  15.                 array determines which sections of the
  16.                 data is to be plotted.  This argument 
  17.                 can be NULL if all the values are valid.
  18.                 Must have been declared as char defined[nx][ny].
  19.     PLFLT left, right, bottom, top
  20.                 Defines the `grid' coordinates.  The data
  21.                 a[0][0] has a position of (left,bottom).
  22.     void (*mapform)()    Transformation from `grid' coordinates to
  23.                 world coordinates.  This pointer to a
  24.                 function can be NULL in which case the
  25.                 grid coordinates are the same as the
  26.                 world coordinates.  
  27.     PLFLT shade_min, shade_max
  28.                 Defines the interval to be shaded. If
  29.                 shade_max <= shade_min, plshade does nothing.
  30.     PLINT sh_color, sh_width
  31.                 defines pen color, width used by the fill pattern
  32.     PLINT min_color, min_width
  33.     PLINT max_color, max_width
  34.                 defines pen color, width used by the boundary
  35.                 of shaded region. The min values are used
  36.                 for the shade_min boundary, and the max values
  37.                 are used on the shade_max boundary.
  38.                 Set color and width to zero for no plotted
  39.                 boundaries.
  40.     void (*fill)()        Routine used to fill the region.  Use plfill.
  41.                 Future version of plplot may have other
  42.                 fill routines.
  43.     PLINT rectangular    Flag. Set to 1 if rectangles map to rectangles
  44.                 after (*mapform)() else set to zero. If
  45.                 rectangular is set to 1, plshade tries to
  46.                 save time by filling large rectangles.  This
  47.                 optimization fails if (*mapform)() distorts
  48.                 the shape of rectangles.  For example a plot
  49.                 in polor coordinates has to have rectangular
  50.                 set to zero.
  51.  
  52. Example mapform's
  53.  
  54. void mapform(PLINT n, PLFLT *x, PLFLT *y) {
  55.     /* does a grid to world coordinate transformation */
  56.     /* this example goes from a r-theta to x-y for a polar plot */
  57.     int i;
  58.     double r, theta;
  59.     for (i = 0; i < n; i++) {
  60.         r = x[i];
  61.         theta = y[i];
  62.         x[i] = r*cos(theta);
  63.         y[i] = r*sin(theta);    
  64.     }
  65. }
  66.  
  67. void mapform(PLINT n, PLFLT *x, PLFLT *y) {
  68.     /* grid was in cm, convert to world coordinates in inches */
  69.     /* expands in x direction */
  70.     int i;
  71.     for (i = 0; i < n; i++) {
  72.         x[i] = (1.0 / 2.5) * x[i];
  73.         y[i] = (1.0 / 2.5) * y[i];
  74.     }
  75. }
  76.  
  77.  
  78. Note: Fortran-style arrays.  Plshade can use fortran-style arrays
  79. with no modification by reflecting the plot through the 45 degree line.
  80.  
  81. void fort_mapform(PLINT n, PLFLT *x, PLFLT *y) {
  82.     /* swap x and y values */
  83.     PLFLT t;
  84.     while (n-- > 0) {
  85.         t = *x;
  86.         *x++ = *y;
  87.         *y++ = t;
  88.     }
  89. }
  90.  
  91. Fortran-style array argments.
  92. void plshade(PLFLT *a, PLINT ny, PLINT nx, char *defined, PLFLT bottom, 
  93.     PLFLT top, PLFLT left, PLFLT right, fort_mapform,
  94.     PLFLT shade_min, PLFLT shade_max, 
  95.     PLINT sh_color, PLINT sh_width, PLINT min_color, PLINT min_width,
  96.     PLINT max_color, PLINT max_width, void (*fill)(), PLINT 1);
  97.  
  98.  
  99. --------------------------------------------------------
  100.  
  101. files needed to run plshade
  102.  
  103. (1) new copy of plfill  (w_plfill.c)
  104.  
  105. (2) w_ctest.c
  106.  
  107. (3) w_plshade.c
  108.  
  109. Note: the 'w_' is help prevent confusion between plplot routines
  110. and local routines.
  111.